pp108 : Creating XML Schema Fragments

Creating XML Schema Fragments

This topic describes the procedure to create XML schema fragments.

A schema fragment consists of elements, complexType or simpleType of an XML schema. You can use these schema fragments in creating rules, decision tables, action templates, condition templates, or data transformations.

  1. From the Workspace Documents (Explorer), right-click the required XML schema and select Add Schema Fragment. Alternatively, open the schema view, click (View Children) on the tool bar, and click in the Add Children pane that appears. The Schema Fragment - Schema Fragment wizard appears.
  2. Type required information in the Name and Description fields of the Schema Fragment - Schema Fragment wizard and click Finish. The XML Schema Editor appears.
  3. You can create a schema fragment in one of the following ways:

    To create or edit a schema fragment in

    Do the following

    Tree tab - graphical representation of the schema fragment

    Click the Tree Tab. In the Schema Tree pane, right-click the element, select Add and select the required child element. Specify the necessary properties for the element in the Properties section. Refer to the image provided in the XML Schema Editor topic.

    Text tab - XSD representation of the schema fragment

    Click the Text tab, and type the schema for the template. Refer to the example provided below.

    • Click the Instance tab to view the XML representation of the schema fragment. You can synchronize the Tree, Instance, and Text views of the XML Schema - the changes you make on one tab are reflected on the other two tabs automatically.
      Note: While synchronizing, the schema editor ensures that the XML Schema you create is valid. An alert is shown when an element is not in the required order or the XML schema provided is not as per the standards.
  4. Click . The schema fragment is created and is attached to the XML schema.
    The schema fragments are created.

    XSD and Instance views of the ProductionOrders Schema Fragment

  • XSD view:
    <xsd:element name="ProductionOrders" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="ID" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element maxOccurs="unbounded" name="OrderDetails">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="UnitPrice" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                            <xsd:element name="Quantity" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                            <xsd:element name="Discount" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="Customer" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="Order_Date" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="Required_Date" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="Shipped_Date" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipVia" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="Freight" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipName" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipAddress" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipCity" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipRegion" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipPostalCode" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                <xsd:element name="ShipCountry" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    
  • Instance View :
    <prod:ProductionOrders xmlns:prod="http://ProductionOrder.com">
        <prod:ID>string</prod:ID>
        <prod:OrderDetails>
            <prod:UnitPrice>string</prod:UnitPrice>
            <prod:Quantity>string</prod:Quantity>
            <prod:Discount>string</prod:Discount>
        </prod:OrderDetails>
        <prod:Customer>string</prod:Customer>
        <prod:Order_Date>string</prod:Order_Date>
        <prod:Required_Date>string</prod:Required_Date>
        <prod:Shipped_Date>string</prod:Shipped_Date>
        <prod:ShipVia>string</prod:ShipVia>
        <prod:Freight>string</prod:Freight>
        <prod:ShipName>string</prod:ShipName>
        <prod:ShipAddress>string</prod:ShipAddress>
        <prod:ShipCity>string</prod:ShipCity>
        <prod:ShipRegion>string</prod:ShipRegion>
        <prod:ShipPostalCode>string</prod:ShipPostalCode>
        <prod:ShipCountry>string</prod:ShipCountry>
    </prod:ProductionOrders>
    

Related concepts

Object Templates

Related tasks

Creating an Object Template
Creating a Business Rule
Generating a Web Service Operation on an Object Template
Building a Decision Table
Creating a Condition Template
Creating an Action Template
Generating a Web Service Operation on a Decision Table
Creating a Data Transformation Model
Transforming Data using XSLT Functions
Testing a Data Transformation Model
Generating a Web Service Operation on a Data Transformation Model
Setting Special Attribute Properties
Creating an XML Schema

Related information

Testing Web Service Operations Using Service Test Tool